{include file="public/header" /}
<style>
    .jine span{
        font-size: 1.0625rem !important;
    }
</style>
<body class="bgc">
    <div class="header">
        <i class="layui-icon layui-icon-left"></i> 支付订单
    </div>

    <div class="pay-news flex-center">
        <p>实付金额</p>
    
        {if $info.order_type==1}
        <div class="jine">￥<span>{$info.real_amount}</span></div>
        {else}
        <div>￥<span>{$info.real_amount}</span>{if $info.integral>0} &nbsp;+&nbsp;<span>{$info.integral}积分</span>{/if}</div>
        {/if}
    </div>

    <ul class="pay-list">
        {if $info.order_type==3}
        <li class="pay_way" data-type="integral">
            <label for="check2">
                <p class="flex-center">
                    <img src="/static/index/img/icon5.png" alt="">
                </p>
                <p class="center">积分</p>
                <img src="/static/index/img/icon7.png" alt="" class="check">
            </label>

        </li>
        {elseif $info.order_type==2}

        <li class="pay_way" data-type="reg_integral">
            <label for="check2">
                <p class="flex-center">
                    <img src="/static/index/img/icon5.png" alt="">
                </p>
                <p class="center">注册积分</p>
                <img src="/static/index/img/icon6.png" alt="" class="check">
            </label>

        </li>
        {else}
        <li class="pay_way" data-type="gold_integral">
            <label for="check2">
                <p class="flex-center">
                    <img src="/static/index/img/icon5.png" alt="">
                </p>
                <p class="center">金积分</p>
                <img src="/static/index/img/icon7.png" alt="" class="check">
            </label>

        </li>
        <li class="pay_way" data-type="group_payment">
            <label for="check2">
                <p class="flex-center">
                    <img src="/static/index/img/icon5.png" alt="">
                </p>
                <p class="center">组合支付（余额 + 金积分）</p>
                <img src="/static/index/img/icon6.png" alt="" class="check">
            </label>

        </li>
        {/if}

    </ul>

    <p class="save save-fixed">确认支付</p>

    <div class="model">
        <div class="pay-mdl">
            <p class="flex-center cancel">
                <img src="/static/index/img/icon54.png" alt="">
            </p>
            <div class="pay-mdl-news">
                <div>请输入支付密码</div>
                {if $info.order_type==1}
                <p class="price jine">￥<span>{$info.real_amount}</span></p>
                {else}
                <p class="price">￥<span>{$info.real_amount}</span> {if $info.integral>0}
                    &nbsp;+&nbsp;<span>{$info.integral}积分</span>{/if}</p>
                {/if}
                <p>支付金额</p>
                <input type="password" id="pay_password" placeholder="请输入支付密码">
                <p class="btn payment">确认支付</p>
            </div>
        </div>
    </div>
</body>
{include file="public/footer"/}
<script>
    $('.pay-list li').click(function () {
        $(this).addClass('pay_way').siblings().removeClass('pay_way');
        $(this).find('.check').attr('src', '/static/index/img/icon7.png')
        $(this).siblings().find('.check').attr('src', '/static/index/img/icon6.png');
        var pay_way = $(".pay_way").attr('data-type');
        if(pay_way == 'group_payment'){
            $('.jine').html("￥<span>金额：{$info.currency}" + " + 金积分：{$info.gold_integral}</span>");
        }else if (pay_way == 'gold_integral') {
            $('.jine').html("￥<span>{$info.real_amount}</span>");
        }
    })

    $(".payment").click(function () {
        var pay_way = $(".pay_way").attr('data-type'), pay_password = $("#pay_password").val();
        if (!pay_way) {
            layer.msg('请选择支付方式');
            return false;
        }
        if (!pay_password) {
            layer.msg('请填写支付密码');
            return false;
        }
        return common.request("{:url('order/confirmPayment')}", {
            id: '{$info.id}',
            pay_way: pay_way,
            pay_password: pay_password
        })
    });

    $('.save-fixed').click(function () {
        var pay_way = $(".pay_way").attr('data-type');
        if (!pay_way) {
            layer.msg('请选择支付方式');
            return false;
        }
        $('.model').show()
    })
    $('.cancel').click(function () {
        $('.model').hide()
    })
</script>

</html>